<?xml version="1.0" encoding="ISO-8859-1" ?>
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:af="http://myfaces.apache.org/trinidad"
	xmlns:afh="http://myfaces.apache.org/trinidad/html">
    
    <afh:tableLayout width="100%">
        <afh:rowLayout styleClass="topWorkArea">
 				
            <afh:cellFormat>
				<af:panelHorizontalLayout rendered="#{portalHeader.withAssemblyLineAssignments}">
	 				<af:panelPopup triggerType="click" modal="true" id="assemblyLinePopup"
	 					title="#{localeBundle.selectParticipantsForAssemblyLine}">
	 					<f:facet name="trigger">
	 						<af:icon id="assemblyLinePopupIcon" name="popupFilter" />
	 					</f:facet>
 					    <af:selectManyCheckbox id="assemblyLineParticipants" simple="true"
 						   value="#{assemblyLineParticipants.selectedParticipants}"
                           onclick="checkAssemblyLineParticipantSelection(this, 
                             '#{localeBundle.chooseAssemblyLineParticipants}', '#{localeBundle.selectAtLeastOneEntry}');">
	 					   <f:selectItems value="#{assemblyLineParticipants.allParticipants}"/>
 					    </af:selectManyCheckbox>
                        <div id="popupBottomBar" class="popupBottomBar">
    						<af:commandLink id="closePopup" text="#{commonMsg.applyChanges}" 
                                partialSubmit="true"
                                action="#{assemblyLineParticipants.applyChanges}"
    							onclick="TrPanelPopup.hidePopup(event); return true;" />
                        </div>
	 				</af:panelPopup>
 					<af:commandNavigationItem
 						id="launchAssemblyLineActivity" styleClass="nextAssemblyLineCommand"
 						shortDesc="#{localeBundle.activateFromAssemblyLine}"
 						action="#{portalHeader.launchAssemblyLineActivity}"
 						immediate="true" partialSubmit="true"
 						returnListener="#{portalHeader.returnActivity}">
                        <af:icon name="nextAssemblyLine"/>
                    </af:commandNavigationItem>
 				</af:panelHorizontalLayout>
 				
 				<af:poll id="refreshTrigger"
 					interval="#{portalHeader.refreshInterval}"
 					pollListener="#{portalHeader.triggerRefresh}"
 					partialTrigger="automaticRefreshInterval"
                    rendered="#{portalHeader.autoRefreshSupported}"
 					binding="#{portalHeader.refreshTrigger}" />
 			</afh:cellFormat>
 				
            <afh:cellFormat width="100%">
                <h:outputFormat id="countOfPendingActivities" styleClass="nextAssemblyLineTextStyle"
                	value="#{portalHeader.countOfPendingActivities == 0 ? localeBundle.noPendingActivity : 
                   (portalHeader.countOfPendingActivities == 1 ? localeBundle.oneAvailableAssemblyLineActivity : localeBundle.manyAvailableAssemblyLineActivities)}"
                   rendered="#{portalHeader.withAssemblyLineAssignments}"
                   partialTriggers=":bpmEvents:refreshEvent:full :bpmEvents:refreshEvent:workarea">
                   <f:param value="#{portalHeader.countOfPendingActivities}"/>
                </h:outputFormat>

            </afh:cellFormat>

            <afh:cellFormat>

                <af:selectOneChoice id="automaticRefreshInterval"
                    label="#{commonMsg.autoRefresh}"
                    autoSubmit="true"
                    value="#{portalHeader.refreshInterval}"
                    rendered="#{portalHeader.autoRefreshSupported and !portalHeader.fixedRefreshInterval}">
                    
                    <af:selectItem label="#{commonMsg.autoRefreshNever}" value="2147483647" />
                    <af:selectItem label="#{commonMsg.autoRefresh30s}" value="#{30 * 1000}" />
                    <af:selectItem label="#{commonMsg.autoRefresh1min}" value="#{60 * 1000}" />
                    <af:selectItem label="#{commonMsg.autoRefresh5min}" value="#{5 * 60 * 1000}" />
                    <af:selectItem label="#{commonMsg.autoRefresh10min}" value="#{10 * 60 * 1000}" />
                    <af:selectItem label="#{commonMsg.autoRefreshUserDefined}: #{portalHeader.userDefinedInterval / 1000}s" 
                        value="#{portalHeader.userDefinedInterval}"
                        rendered="#{portalHeader.userDefinedInterval != null}"/>
                </af:selectOneChoice>
 				
 			</afh:cellFormat>

        </afh:rowLayout>
        <afh:rowLayout id="statusbarRow" rendered="#{processPortalStatusbar.statusbarVisible}"
            styleClass="statusbarArea">
            <afh:cellFormat columnSpan="3" halign="left"
                partialTriggers=":bpmEvents:refreshEvent:full :bpmEvents:refreshEvent:workarea :taskTable:selectedParticipantInSB" >
                <af:showDetail styleClass="showDetailStatusbar" disclosed="true"
                    disclosedText="#{localeBundle.hideStatusbar}" 
                    undisclosedText="#{localeBundle.showStatusbar}"
                    partialTriggers="activityTable:delegationIcon activityTable:delegationBtn">

                    <ui:include src="statusbar.xhtml" />

                </af:showDetail>
            </afh:cellFormat>
        </afh:rowLayout>        
        <afh:rowLayout valign="top" id="taskTableRow" styleClass="taskTableArea">
            <afh:cellFormat columnSpan="3" valign="top"
            	partialTriggers=":bpmEvents:refreshEvent:full :bpmEvents:refreshEvent:workarea :taskTable:activityTable :mainNavBar:filterMenuEntry">

			<c:choose>
				<c:when test="#{not empty portalHeader.currentWorklistModel.contentFaceletUrl}">

					<ui:include src="#{portalHeader.currentWorklistModel.contentFaceletUrl}">
						<ui:param name="taskTableWithActions" value="#{true}" />
			
						<ui:param name="taskTableLaunchActivityDelegate" value="#{workAreaLaunchActivityDelegate}" />
					</ui:include>

				</c:when>
				<c:otherwise>
	
					<af:panelBox text="#{portalHeader.worklistLabel}" background="light" 
                        partialTriggers="activityTable:delegationIcon activityTable:delegationBtn">
						<ui:include src="tasks-table.xhtml">
							<ui:param name="taskTableWithActions" value="#{true}" />
				
							<ui:param name="taskTableLaunchActivityDelegate" value="#{workAreaLaunchActivityDelegate}" />
						</ui:include>
					</af:panelBox>
	
				</c:otherwise>
			</c:choose>

            </afh:cellFormat>
    
        </afh:rowLayout>
    
    </afh:tableLayout>
   
</ui:composition>